<template>
    <div class="user-register">
        <el-card class="box-card">
            <div>
                <register-form :captchaIsShow="isShow" @registerForm="firstSign" :register-params="registerParams"></register-form>
            </div>
        </el-card>
    </div>
</template>

<script>
    import {firstsign} from "../../request/api";
    import registerForm from "../../components/registerForm/registerForm";
    export default {
        name: "userRegister",
        data(){
            return{
                registerParams:[],
                isShow:true
            }
        },
        methods: {
            //首次报名
            firstSign(params){
              firstsign(params).then(res =>{
                  this.$cookies.set("token",res.token)
                  this.$store.commit('setToken',res.token)
                  console.log(res);
                  this.$message({
                      type:'success',
                      message:'报名成功'
                  })
                  this.$router.push('/user/index')
              }).catch(err =>{
                  this.isShow = false;
                  console.log(err);
                  this.$message({
                      type:'error',
                      message:err.msg
                  })
              })
            }
        },
        components:{
            registerForm
        }
    }
</script>

<style scoped>
    .box-card {
        width: auto;
    }

    .user-register {
        width: 1200px;
        margin: 0 auto;
    }
</style>
